/**
 * 
 */
package com.redside.dao.hibernate;

import java.util.List;

import org.hibernate.Criteria;
import org.hibernate.criterion.Expression;

import com.redside.dao.NotesDao;
import com.redside.model.Note;

/**
 * This class interacts with Spring and Hibernate to save and retrieve Business
 * objects.
 * 
 * @author <a href="mailto:pchapman@easystreet.com">Peter Chapman</a>
 */
public class NotesDaoHibernate extends GenericDaoHibernate<Note, Long> implements NotesDao {

    public NotesDaoHibernate() {
        super(Note.class);
    }
    
	/* (non-Javadoc)
	 * @see com.redside.dao.NotesDao#findByComplaintId(java.lang.Long, java.lang.Long)
	 */
	@SuppressWarnings("unchecked")
	public List<Note> findByComplaintId(Long id, Long noteTypeId) {
		Criteria criteria = getSession().createCriteria(Note.class);
        criteria.add(Expression.eq("complaint.id",id));
        criteria.add(Expression.eq("noteTypeLkp.id",noteTypeId));
    	return criteria.list();
	}
}
